package com.zpark.controller;


import com.zpark.common.Response;
import com.zpark.entity.Experience;
import com.zpark.service.IExperienceService;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lx
 * @since 2024-03-18
 */
@RestController
@RequestMapping("/experience")
public class ExperienceController {
    @Resource
    private IExperienceService experience;
    @GetMapping("/selectByCv_id/{id}")
    public Response selectByCv_id(@PathVariable("id") int cvId){
        List<Experience> experienceList= experience.selectByCv_id(cvId);
        System.out.println(experienceList);
        return Response.success(experienceList);
    }
    //根据id删除
    @DeleteMapping("/deleteById/{id}")
    public Response deleteById(@PathVariable("id") int id){
        int i = experience.deleteById(id);
        if (i==0)
           return Response.failure().setMessage("删除失败");
        else
           return Response.success().setMessage("删除成功");
    }
}
